/*
 * @Author: leevan
 * @Date: 2022-02-10 11:22:12
 * @LastEditTime: 2022-02-11 16:26:22
 * @LastEditors: leevan
 * @FilePath: /usermanagecenter/src/service/role.service/index.js
 */

import {
    queryAllRole_path,
    queryPageRole_path,
    queryRelationMenu_path,
    queryMenuList_path,
    RoleHandler_path,
    deleteRole_path,
    saveRole_path
} from './path';

import {
    POST , GET, PUT, DELETE, PATCH
} from '@/plugins/axios';


//获取角色
export const queryAllRole = (pageSize,pageNo)=> {
    return GET(queryAllRole_path());
};

//获取分页角色
export const queryPageRole = (pageSize,pageNo,roleName = '')=> {
    return GET(queryPageRole_path(),{pageSize,pageNo,roleName},{'content-type':'application/json'});
};

//查询所有菜单
export const queryMenuList = () => {
    return GET(queryMenuList_path())
}

//查询关联角色
export const queryRelationMenu = roleId => {
    return GET(queryRelationMenu_path(roleId))
}

//角色信息操作
export const RoleHandler = data => {
    return PUT(RoleHandler_path(),data,{'content-type':'application/json'})
}

//更新角色
export const UpdateRole = data => {
    return PATCH(RoleHandler_path(),data,{'content-type':'application/json'})
}

//删除角色信息
export const deleteRole = roleId => {
    return DELETE(deleteRole_path(roleId))
}

//保存
export const saveRole = (data,roleId) => {
    return PATCH(saveRole_path(roleId),data,{'content-type':'application/json'});
}
